<?php
function makevar($nme) {
	global $map;
	$tmp = $map[$nme][1];
	unset($map[$nme]);
	$map[$nme] = $tmp;
}
$data = file_get_contents("maps/thefirstraid.scm");
if(preg_match("/info \{[\n\r]|.+?\}/", $data) && preg_match("/map \{[\n\r]|.+?\}/", $data)) {
	preg_match("/map \{([\n\r]|.)+\}$/", $data, $map['map']);
	print_r($map);
	preg_match("/Name\: ([a-zA-Z0-9 ]+)/", $data, $map['name']);
	preg_match("/Author\: ([a-zA-Z0-9 ]+)/", $data, $map['author']);
	preg_match("/Gametype\: ([a-zA-Z0-9 ]+)/", $data, $map['gametype']);
	preg_match("/Tilesize\: ([a-zA-Z0-9 ]+)/", $data, $map['tilesize']);
	makevar("name");
	makevar("author");
	makevar("gametype");
	makevar("tilesize");
	makevar("map");
	echo "Map name: " . $map['name'] . "<br/>";
	echo $map['map'];
} else {
	die("Corrupt map.");
}
?>